﻿using Microsoft.AspNetCore.Mvc;
using Project.Frame.Net.Application.UserApplication;
using Project.Frame.Net.Filters;
using Project.Yan.Net.BLL.DTOs;

namespace Project.Frame.Net.Controllers
{
    [ApiController]
    [Route("/api/[controller]/[action]")]
    [ApiResult]
    public class UserColtroller : ControllerBase
    {
        private readonly  IUserService _userService;
       public UserColtroller(IUserService userService)
        {
            _userService = userService;
        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <param name="email"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<UserUserInfoModel_Respose?> GetUserByEmail(string email)
        {
            //TODO: get user by id
            var result= await _userService.GetUserByUserIEmail(email);
            if (result==null)   
            {
                return null;
            }
            await _userService.LogInfoTest(email);     
            return result;
        }
    }
}
